#!/usr/bin/env python
# -*- coding: utf-8 -*-

from distutils.core import setup
from os import listdir
from os.path import isdir, isfile
import os
import py2exe

import config

DATA_FILES = [("", ["LICENSE.txt"]),
    ("htm", [os.path.join("htm", "index.htm")])]
# Language
pofile = "LC_MESSAGES/messages"
for dir in [d for d in listdir("locale") if d.find(".svn") < 0 and isdir("locale/"+d)]:
    DATA_FILES += [("locale/"+dir+"/LC_MESSAGES", ["locale/"+dir+"/"+pofile+".mo"])]

setup(
    name = config.APP_NAME, 
    version = config.__appversion__, 
    license = config.__license__, 
    author = 'Wang Bin', 
    author_email = '<wangbnly@gmail.com>', 
    scripts=['Main.py'],
    windows=[
        {
            'script': 'WbMFT.pyw',
            'icon_resources': [(1, os.path.join('img', 'main.ico'))],
        }
    ],
    data_files=DATA_FILES,
    options = {
        'py2exe' : {'compressed': 1,
                    'optimize': 2,
                    'bundle_files': 1},
        'sdist': {
            'formats': 'zip',
        }
    }
)
